<?php
    $tems = new XTemplate('sites/tpml/qlmon/listall.html');
    $id_nam = $_GET['idnam'];
    $id_khoi = $_GET['idkhoi'];
    $sql = "SELECT monhoc.*,namhoc.ten AS tennamhoc,khoi.ten AS khoihoc
            FROM `monhoc`
            LEFT JOIN khoi ON khoi.id = monhoc.id_khoi
            LEFT JOIN namhoc ON namhoc.id = khoi.id_namhoc
            WHERE monhoc.id_khoi =$id_khoi
            AND namhoc.id =$id_nam
            ";
    $data = $db->GetArray($sql);
    if(count($data)>0){
      foreach($data as $val){
            $tems->insert_loop('LISTMON.LOOP',array('LOOP'=>$val));
       }
    }
    $tems->assign('tit','Quản lý môn học');
    $tems->parse('LISTMON');
    $maincontent=$tems->text('LISTMON');
?>